<?php

class SoapResultSet
	implements
		Iterator
{
	protected $resultPointer = 0;
	protected $result	= array();
	protected $metadata	= null;
	
	/**
	 * 
	 */
	function __construct( stdClass $metadata, array $resultObjects ) {
		$this->result	= $resultObjects;
		$this->metadata	= $metadata;
	}
	
	public function getMetadata()
	{
		return $this->metadata;
	}
	
	/**
	 * 
	 * @see Iterator::current()
	 */
	public function current() {
		return current( $this->result );
	}
	
	/**
	 * 
	 * @see Iterator::key()
	 */
	public function key() {
		return key( $this->result );	
	}
	
	/**
	 * 
	 * @see Iterator::next()
	 */
	public function next() {
		return next( $this->result );
	}
	
	/**
	 * 
	 * @see Iterator::rewind()
	 */
	public function rewind() {
		return reset( $this->result );
	}
	
	/**
	 * 
	 * @see Iterator::valid()
	 */
	public function valid() {
		return $this->current() !== false;	
	}
}

?>